/*   1:    */ package com.atomikos.beans;
/*   2:    */ 
/*   3:    */ import java.awt.Component;
/*   4:    */ import java.beans.PropertyChangeListener;
/*   5:    */ import java.beans.PropertyEditor;
/*   6:    */ 
/*   7:    */ class EditorImp
/*   8:    */   implements Editor
/*   9:    */ {
/*  10:    */   private PropertyEditor editor_;
/*  11:    */   private Property property_;
/*  12:    */   private Object editedObject_;
/*  13:    */   private PropertyChangeAdapter adapter_;
/*  14:    */   
/*  15:    */   EditorImp(Property property, PropertyEditor editor)
/*  16:    */     throws PropertyException
/*  17:    */   {
/*  18: 66 */     this.editor_ = editor;
/*  19: 67 */     this.property_ = property;
/*  20:    */     try
/*  21:    */     {
/*  22: 69 */       editor.setValue(property.getValue());
/*  23:    */     }
/*  24:    */     catch (PropertyException writeOnlyProperty) {}
/*  25: 75 */     this.adapter_ = new PropertyChangeAdapter(this);
/*  26: 76 */     this.editor_.addPropertyChangeListener(this.adapter_);
/*  27:    */   }
/*  28:    */   
/*  29:    */   protected PropertyEditor getPropertyEditor()
/*  30:    */   {
/*  31: 82 */     return this.editor_;
/*  32:    */   }
/*  33:    */   
/*  34:    */   public Object getEditedObject()
/*  35:    */   {
/*  36: 87 */     return this.editor_.getValue();
/*  37:    */   }
/*  38:    */   
/*  39:    */   public void setEditedObject(Object value)
/*  40:    */   {
/*  41: 92 */     this.editor_.setValue(value);
/*  42:    */   }
/*  43:    */   
/*  44:    */   public void addPropertyChangeListener(PropertyChangeListener l)
/*  45:    */   {
/*  46: 98 */     this.adapter_.addPropertyChangeListener(l);
/*  47:    */   }
/*  48:    */   
/*  49:    */   public void removePropertyChangeListener(PropertyChangeListener l)
/*  50:    */   {
/*  51:105 */     this.adapter_.removePropertyChangeListener(l);
/*  52:    */   }
/*  53:    */   
/*  54:    */   public Property getProperty()
/*  55:    */   {
/*  56:110 */     return this.property_;
/*  57:    */   }
/*  58:    */   
/*  59:    */   public void setStringValue(String val)
/*  60:    */     throws PropertyException
/*  61:    */   {
/*  62:    */     try
/*  63:    */     {
/*  64:128 */       Object o = PrimitiveClasses.createWrapperObject(val, this.property_.getType());
/*  65:129 */       this.editor_.setValue(o);
/*  66:    */     }
/*  67:    */     catch (ClassNotPrimitiveException e)
/*  68:    */     {
/*  69:    */       try
/*  70:    */       {
/*  71:138 */         this.editor_.setAsText(val);
/*  72:    */       }
/*  73:    */       catch (Exception err)
/*  74:    */       {
/*  75:141 */         throw new PropertyException(err);
/*  76:    */       }
/*  77:    */     }
/*  78:    */   }
/*  79:    */   
/*  80:    */   public String getStringValue()
/*  81:    */     throws PropertyException
/*  82:    */   {
/*  83:149 */     return this.editor_.getAsText();
/*  84:    */   }
/*  85:    */   
/*  86:    */   public Component getComponent()
/*  87:    */   {
/*  88:154 */     return this.editor_.getCustomEditor();
/*  89:    */   }
/*  90:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\atomikos-util\3.7.0\atomikos-util-3.7.0.jar
 * Qualified Name:     com.atomikos.beans.EditorImp
 * JD-Core Version:    0.7.0.1
 */